package com.wfuhui.book.ui.book;

import android.os.Bundle;
import android.view.MenuItem;
import android.widget.ScrollView;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;

import com.wfuhui.book.R;

import org.json.JSONException;
import org.json.JSONObject;

public class BookReadActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setContentView(R.layout.activity_book_read);
        String payBook = getIntent().getStringExtra("readBook");
        TextView bookName = findViewById(R.id.bookName);
        TextView show = findViewById(R.id.textShow);
        try {
            JSONObject json = new JSONObject(payBook);
            bookName.setText(json.getString("bookName"));
            show.setText(json.getString("describe"));
        } catch (JSONException e) {
            throw new RuntimeException(e);
        }
    }

    @Override
    public boolean onOptionsItemSelected(@NonNull MenuItem item) {
        //返回按钮点击事件
        if (item.getItemId() == android.R.id.home) {
            finish();
            return true;
        }
        return super.onOptionsItemSelected(item);
    }
}